Skip to content

fix: consume plans on implementation#1133

Open
UtkarshUsername wants to merge 2 commits intopingdotgg:mainfrom
UtkarshUsername:fix/consume-plan-on-same-thread-implementation
Open

fix: consume plans on implementation#1133
UtkarshUsername wants to merge 2 commits intopingdotgg:mainfrom
UtkarshUsername:fix/consume-plan-on-same-thread-implementation

Conversation

@UtkarshUsername
Copy link
Contributor

@UtkarshUsername UtkarshUsername commented Mar 16, 2026

You can see my PRs and issues at https://pr-navigator.pages.dev/t3code-utkarsh.
Fixes #770

What Changed

This changes the primary same-thread Implement flow so a proposed plan is consumed when its implementation turn actually starts.

The PR includes the shared plan-consumption plumbing needed to support that behavior end to end:

  • proposed plans now carry implementation metadata
  • thread.turn.start can reference a source proposed plan
  • orchestration persists that source-plan reference through turn start projection
  • provider runtime ingestion marks the source plan implemented only when the target turn is accepted as started
  • the web app treats only unimplemented plans as actionable

On the web side, the same-thread Implement action now passes sourceProposedPlan. As a result, once the implementation turn starts successfully, the thread no longer treats that plan as actionable and the plan follow-up UI disappears.

This branch intentionally does not change Implement in new thread. That will follow in a stacked PR reusing the same plumbing.

Why

Before this change, same-thread implementation switched the thread out of plan mode, which hid Plan Ready temporarily, but it never consumed the underlying proposed plan in domain state.

That meant the plan could become actionable again later if the thread returned to plan mode or another client reloaded from the read model. This also prevented users from making multiple plans in the same thread (see #770). The fix is to make plan consumption explicit and tie it to the accepted start of the implementation turn, not to a UI mode switch.

UI Changes

Before:
(Plan has already been implemented but it still shows the implementation/refine UI.)
image

After:
(Same-thread Implement consumes the plan once the implementation turn actually starts. The thread no longer shows the follow-up plan actions for that consumed plan.)
image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes

Note

Mark proposed plans as implemented when a follow-up turn starts on an implementation thread

  • When a thread.turn.start command includes a sourceProposedPlan reference, the decider validates the source plan exists on the same project and embeds it in the thread.turn-start-requested event.
  • On an accepted turn.started event that matches the provider's expected active turn, ProviderRuntimeIngestion dispatches a thread.proposed-plan.upsert with implementedAt and implementationThreadId set on the source plan.
  • Two new DB migrations add implemented_at/implementation_thread_id to projection_thread_proposed_plans and source_proposed_plan_thread_id/source_proposed_plan_id to projection_turns.
  • The web client attaches sourceProposedPlan when sending a follow-up turn start and uses the new hasActionableProposedPlan helper to hide the follow-up prompt and 'Plan Ready' status for already-implemented plans.
  • Behavioral Change: threads whose plan has been implemented no longer show 'Plan Ready' in the sidebar; they fall through to other status rules.

Macroscope summarized b676658.

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 110e6040-a504-4729-ad18-e68f195c4493

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 16, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9026795ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@UtkarshUsername UtkarshUsername changed the title fix(orchestration): consume plans on same-thread implementation fix: consume plans on implementation Mar 16, 2026
@UtkarshUsername
Copy link
Contributor Author

image

Plan is still visible in the sidebar by the way, in case you were wondering

@UtkarshUsername
Copy link
Contributor Author

UtkarshUsername commented Mar 16, 2026

UtkarshUsername#2 is stacked on top of this. After this PR is merged, will retarget that to main (see https://pr-navigator.pages.dev/t3code-utkarsh).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan mode support only one plan

1 participant